from unittest import TestCase

from algo.sequences import is_subsequence


class TestSequences(TestCase):
    def test_is_subsequence_empty(self):
        seq1 = []
        seq2 = []
        expected = True
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_empty2(self):
        seq1 = [1]
        seq2 = []
        expected = True
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_only_one(self):
        seq1 = [1]
        seq2 = [1]
        expected = True
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_different(self):
        seq1 = [1]
        seq2 = [2]
        expected = False
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_bigger(self):
        seq1 = [1]
        seq2 = [1, 2]
        expected = False
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_not1(self):
        seq1 = [10, 5, 2]
        seq2 = [2, 5, 10]
        expected = False
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_not2(self):
        seq1 = [3, 2, 5, 4, 6, 10, 1]
        seq2 = [2, 5, 10, 6]
        expected = False
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_e1(self):
        seq1 = [3, 2, 5, 4, 6, 10, 1]
        seq2 = [2, 5, 10]
        expected = True
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_e2(self):
        seq1 = [3, 2, 5, 4, 6, 10, 1]
        seq2 = [2, 5]
        expected = True
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)

    def test_is_subsequence_e3(self):
        seq1 = [1, 1, 1, 1, 1, 1, 2, 5, 10]
        seq2 = [2, 5, 10]
        expected = True
        result = is_subsequence(seq1, seq2)
        self.assertEqual(result, expected)
